<!--

	Actipro Software's WPF DataGrid Contrib Add-on
	http://actipro.codeplex.com/

	Copyright (c) 2009-2015 Actipro Software LLC. 

	This source code is subject to the terms of the Microsoft Public License (Ms-PL). 

	Redistribution and use in source and binary forms, with or without modification, 
	is permitted provided that redistributions of the source code retain the above 
	copyright notices and this file header. 

	Additional copyright notices should be appended to the list above. 

	For details, see <http://www.opensource.org/licenses/ms-pl.html>. 

	All other rights reserved. 

-->
	
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:datagrid="clr-namespace:ActiproSoftware.Windows.Controls.DataGrid"
		xmlns:datagridThemes="clr-namespace:ActiproSoftware.Windows.Themes"
		xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
		xmlns:system="clr-namespace:System;assembly=mscorlib"
		xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
		>

	<system:String x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type DataGrid},ResourceId=Theme}">Aero.NormalColor</system:String>

	<!-- Converters -->
	<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

	<!-- DataGridColumnHeadersPresenterStyle -->
	<Style x:Key="DataGridColumnHeadersPresenterStyle" TargetType="{x:Type DataGridColumnHeadersPresenter}">
		<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundNormalBrushKey}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderNormalBrushKey}}" />
		<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderNormalThicknessKey}}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DataGridColumnHeadersPresenter}">

					<!-- 12/12/2011 - Updated to use ElementChrome so classic themes look good -->
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>
						<DataGridColumnHeader x:Name="PART_FillerColumnHeader" Visibility="Hidden" />
						<ItemsPresenter />
						<shared:ElementChrome Grid.Column="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
								BorderStyle="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderElementChromeBorderStyleKey}}" SnapsToDevicePixels="true" />
					</Grid>

				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- DataGridColumnHeaderGripperStyle -->
	<Style x:Key="DataGridColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="Cursor" Value="{x:Static datagridThemes:DataGridCursors.ColumnResizeCursor}" />
		<Setter Property="Width" Value="4" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- datagridThemes:DataGridResourceKeys.DataGridColumnHeaderStyleKey -->
	<Style x:Key="{x:Static datagridThemes:DataGridResourceKeys.DataGridColumnHeaderStyleKey}" TargetType="{x:Type DataGridColumnHeader}">
		<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundNormalBrushKey}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderNormalBrushKey}}" />
		<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderNormalThicknessKey}}" />
		<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderForegroundNormalBrushKey}}" />

		<Setter Property="themes:ThemeProperties.IsGlassEnabled" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListIsGlassEnabledBooleanKey}}" />

		<Setter Property="Padding" Value="0,1" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="SnapsToDevicePixels" Value="True" />

		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">

					<shared:ElementChrome x:Name="chrome" Background="{TemplateBinding Background}"
							BackgroundDisabled="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundDisabledBrushKey}}"
							BackgroundFocused="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundSelectedNormalBrushKey}}"
							BackgroundHover="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundHoverBrushKey}}"
							BackgroundPressed="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundPressedBrushKey}}"
							BorderBrush="{TemplateBinding BorderBrush}"
							BorderBrushDisabled="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderDisabledBrushKey}}"
							BorderBrushFocused="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderSelectedNormalBrushKey}}"
							BorderBrushHover="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderHoverBrushKey}}"
							BorderBrushPressed="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderPressedBrushKey}}"
							BorderThickness="{TemplateBinding BorderThickness}" 
							BorderStyle="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderElementChromeBorderStyleKey}}"
							SnapsToDevicePixels="true">
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition MaxHeight="7" />
								<RowDefinition />
							</Grid.RowDefinitions>
							<Rectangle x:Name="highlight"
									Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(themes:ThemeProperties.IsGlassEnabled), Converter={StaticResource BooleanToVisibilityConverter}}" />
							<Border Grid.RowSpan="2" Padding="{TemplateBinding Padding}">
								<DockPanel x:Name="headerContent" LastChildFill="True" Margin="0,0,1,1">
									<Path x:Name="SortArrow" DockPanel.Dock="Right" Visibility="Collapsed" Data="M 0,0 L 4,4 L 8,0 Z" Width="9" Height="5" Stretch="Fill"
											Fill="{TemplateBinding Foreground}" Margin="-2,0,6,0" Stroke="White" StrokeThickness="1" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" />
									<shared:PixelSnapper VerticalRoundMode="CeilingToEven">
										<ContentPresenter Margin="6,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
												HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="False" />
									</shared:PixelSnapper>
								</DockPanel>
							</Border>

							<Thumb x:Name="PART_LeftHeaderGripper" Grid.RowSpan="2" HorizontalAlignment="Left" Style="{StaticResource DataGridColumnHeaderGripperStyle}" Margin="-1,0,0,0" />
							<Thumb x:Name="PART_RightHeaderGripper" Grid.RowSpan="2" HorizontalAlignment="Right" Style="{StaticResource DataGridColumnHeaderGripperStyle}" Margin="0,0,-1,0" />
						</Grid>

					</shared:ElementChrome>

					<ControlTemplate.Triggers>
						<Trigger Property="datagrid:FocusBehavior.IsFocusedHeader" Value="True">
							<Setter TargetName="chrome" Property="State" Value="Focused" />
							<Setter TargetName="highlight" Property="Fill" Value="#75FFFFFF" />
						</Trigger>
						<Trigger Property="IsMouseOver" Value="true">
							<Setter TargetName="chrome" Property="State" Value="Hover" />
							<Setter TargetName="highlight" Property="Fill" Value="#75FFFFFF" />
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsMouseOver" Value="True" />
								<Condition Property="datagrid:FocusBehavior.IsFocusedHeader" Value="True" />
							</MultiTrigger.Conditions>
							<Setter TargetName="chrome" Property="BackgroundFocused" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundSelectedHoverBrushKey}}" />
							<Setter TargetName="chrome" Property="BorderBrushFocused" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderSelectedHoverBrushKey}}" />
							<Setter TargetName="chrome" Property="State" Value="Focused" />
						</MultiTrigger>
						
						<Trigger Property="IsPressed" Value="true">
							<Setter TargetName="chrome" Property="State" Value="Pressed" />
							<Setter TargetName="highlight" Property="Fill" Value="#75FFFFFF" />
							<Setter TargetName="headerContent" Property="Margin" Value="1,1,0,0" />
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ControlForegroundDisabledBrushKey}}" />
							<Setter TargetName="chrome" Property="State" Value="Disabled" />
							<Setter TargetName="highlight" Property="Fill" Value="{x:Null}" />
						</Trigger>

						<Trigger Property="CanUserSort" Value="True">
							<Setter TargetName="SortArrow" Property="Visibility" Value="Hidden" />
						</Trigger>
						<Trigger Property="SortDirection" Value="Ascending">
							<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
							<Setter TargetName="SortArrow" Property="RenderTransform">
								<Setter.Value>
									<ScaleTransform ScaleY="-1" />
								</Setter.Value>
							</Setter>
						</Trigger>
						<Trigger Property="SortDirection" Value="Descending">
							<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
						</Trigger>
						<Trigger Property="DisplayIndex" Value="0">
							<Setter TargetName="PART_LeftHeaderGripper" Property="Visibility" Value="Collapsed" />
						</Trigger>

						<Trigger Property="Height" Value="Auto">
							<Setter Property="MinHeight" Value="20" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- DataGridRowHeaderGripperStyle -->
	<!-- Not currently used by DataGridRowHeader Style due to issue setting DataGrid.RowHeaderStyle
	<Style x:Key="DataGridRowHeaderGripperStyle" TargetType="{x:Type Thumb}">
		<Setter Property="Height" Value="3" />
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="Cursor" Value="{x:Static datagridThemes:DataGridCursors.RowResizeCursor}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>-->

	<!-- datagridThemes:DataGridResourceKeys.DataGridRowHeaderStyleKey -->
	<Style x:Key="{x:Static datagridThemes:DataGridResourceKeys.DataGridRowHeaderStyleKey}" TargetType="{x:Type DataGridRowHeader}">
		<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundNormalBrushKey}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderNormalBrushKey}}" />
		<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderNormalThicknessKey}}" />
		<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ControlForegroundNormalBrushKey}}" />

		<Setter Property="SnapsToDevicePixels" Value="True" />
		
		<!-- Removed setting of the control template due to an issue with the DataGrid.RowHeaderStyle property. Also, moved
			 triggers to the Style so the visual aspects are retained. (http://wpf.codeplex.com/WorkItem/View.aspx?WorkItemId=10233)
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DataGridRowHeader}">

					<Grid>
						<DataGridHeaderBorder IsSelected="{TemplateBinding IsRowSelected}"
								IsHovered="{TemplateBinding IsMouseOver}" IsPressed="{TemplateBinding IsPressed}"
								Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
								BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"
								Orientation="Horizontal" SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
								SeparatorBrush="{TemplateBinding SeparatorBrush}">

							<StackPanel Orientation="Horizontal">
								<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
										VerticalAlignment="Center" />
								<Control SnapsToDevicePixels="false"
										Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=(Validation.HasError), Converter={StaticResource BooleanToVisibilityConverter}}"
										Template="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=ValidationErrorTemplate}" />
							</StackPanel>
						</DataGridHeaderBorder>
						<Thumb x:Name="PART_TopHeaderGripper" VerticalAlignment="Top"
								Style="{StaticResource DataGridRowHeaderGripperStyle}" />
						<Thumb x:Name="PART_BottomHeaderGripper" VerticalAlignment="Bottom"
								Style="{StaticResource DataGridRowHeaderGripperStyle}" />
					</Grid>

					<ControlTemplate.Triggers>
						<Trigger Property="IsRowSelected" Value="True">
							<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundSelectedNormalBrushKey}}" />
							<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderSelectedNormalBrushKey}}" />
							<Setter Property="BorderThickness" Value="0,1,1,1" />
							<Setter Property="Margin" Value="0,-1,0,0" />
						</Trigger>
		
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundHoverBrushKey}}" />
							<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderHoverBrushKey}}" />
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsRowSelected" Value="True" />
								<Condition Property="IsMouseOver" Value="True" />
							</MultiTrigger.Conditions>
							<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundSelectedHoverBrushKey}}" />
							<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderSelectedHoverBrushKey}}" />
						</MultiTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>-->

		<Style.Triggers>
			<Trigger Property="IsRowSelected" Value="True">
				<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundSelectedNormalBrushKey}}" />
				<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderSelectedNormalBrushKey}}" />
				<Setter Property="BorderThickness" Value="0,1,1,1" />
				<Setter Property="Margin" Value="0,-1,0,0" />
			</Trigger>
			
			<Trigger Property="IsMouseOver" Value="True">
				<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundHoverBrushKey}}" />
				<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderHoverBrushKey}}" />
			</Trigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsRowSelected" Value="True" />
					<Condition Property="IsMouseOver" Value="True" />
				</MultiTrigger.Conditions>
					<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBackgroundSelectedHoverBrushKey}}" />
					<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowHeaderBorderSelectedHoverBrushKey}}" />
			</MultiTrigger>
		</Style.Triggers>
	</Style>

	<!-- DataGridSelectAllStyle -->
	<Style x:Key="DataGridSelectAllStyle" TargetType="{x:Type Button}">
		<Setter Property="OverridesDefaultStyle" Value="true" />

		<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBackgroundNormalBrushKey}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderNormalBrushKey}}" />
		<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderBorderNormalThicknessKey}}" />
		
		<Setter Property="Command" Value="{x:Static DataGrid.SelectAllCommand}" />
		<Setter Property="Focusable" Value="False" />
		<Setter Property="SnapsToDevicePixels" Value="True" />
		
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<shared:ElementChrome x:Name="chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
							BorderStyle="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderElementChromeBorderStyleKey}}" Padding="1" SnapsToDevicePixels="true">

						<Polygon x:Name="arrow" Fill="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderGlyphBackgroundNormalBrushKey}}"
								Stroke="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderGlyphBorderNormalBrushKey}}" StrokeThickness="1" Margin="0,0,1,2"
								HorizontalAlignment="Right" VerticalAlignment="Bottom" Points="0,6 7,6 7,0" />
					</shared:ElementChrome>

					<ControlTemplate.Triggers>
						<Trigger Property="IsPressed" Value="True">
							<Setter TargetName="arrow" Property="Fill" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListColumnHeaderGlyphBackgroundPressedBrushKey}}" />
						</Trigger>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Visibility" TargetName="arrow" Value="Collapsed" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- datagridThemes:DataGridResourceKeys.DataGridCellStyleKey -->
	<Style x:Key="{x:Static datagridThemes:DataGridResourceKeys.DataGridCellStyleKey}" TargetType="{x:Type DataGridCell}">
		<Setter Property="OverridesDefaultStyle" Value="true" />
		
		<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBackgroundNormalBrushKey}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderNormalBrushKey}}" />
		<!--<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderNormalThicknessKey}}" />-->
		<Setter Property="BorderThickness" Value="0" />
		<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ControlForegroundNormalBrushKey}}" />

		<!--<Setter Property="themes:ThemeProperties.CornerRadius" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderNormalCornerRadiusKey}}" />-->
		<Setter Property="themes:ThemeProperties.IsGlassEnabled" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListIsGlassEnabledBooleanKey}}" />

		<Setter Property="FocusVisualStyle" Value="{x:Null}" />

		<Setter Property="Padding" Value="1,2,1,1" />

		<Setter Property="HorizontalContentAlignment" Value="Stretch" />
		<Setter Property="VerticalContentAlignment" Value="Center" />

		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DataGridCell}">
					<shared:ElementChrome x:Name="chrome" Background="{TemplateBinding Background}"
							BackgroundDisabled="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBackgroundDisabledBrushKey}}"
							BackgroundHover="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBackgroundHoverBrushKey}}"
							BackgroundFocused="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBackgroundSelectedFocusedBrushKey}}"
							BorderBrush="{TemplateBinding BorderBrush}"
							BorderBrushDisabled="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderDisabledBrushKey}}"
							BorderBrushHover="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderHoverBrushKey}}"
							BorderBrushFocused="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderSelectedFocusedBrushKey}}"
							BorderThickness="{TemplateBinding BorderThickness}"
							InnerBorderThickness="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemInnerBorderNormalThicknessKey}}"
							CornerRadius="{TemplateBinding themes:ThemeProperties.CornerRadius}"
							SnapsToDevicePixels="true">
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition MaxHeight="11" />
								<RowDefinition />
							</Grid.RowDefinitions>
							<Rectangle x:Name="highlight"
									Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(themes:ThemeProperties.IsGlassEnabled), Converter={StaticResource BooleanToVisibilityConverter}}" />
							<ContentPresenter Grid.RowSpan="2" Margin="{TemplateBinding Padding}"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
						</Grid>
					</shared:ElementChrome>

					<ControlTemplate.Triggers>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsMouseOver" Value="true" />
								<Condition Property="IsSelected" Value="false" />
							</MultiTrigger.Conditions>
							<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemForegroundHoverBrushKey}}" />
							<Setter TargetName="chrome" Property="State" Value="Hover" />
							<Setter TargetName="highlight" Property="Fill" Value="#75FFFFFF" />
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsEditing" Value="false" />
								<Condition Property="IsMouseOver" Value="true" />
								<Condition Property="IsSelected" Value="true" />
							</MultiTrigger.Conditions>
							<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemForegroundSelectedHoverBrushKey}}" />
							<Setter TargetName="chrome" Property="BackgroundHover" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBackgroundSelectedHoverBrushKey}}" />
							<Setter TargetName="chrome" Property="BorderBrushHover" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderSelectedHoverBrushKey}}" />
							<Setter TargetName="chrome" Property="State" Value="Hover" />
							<Setter TargetName="highlight" Property="Fill" Value="#75FFFFFF" />
						</MultiTrigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsEditing" Value="false" />
								<Condition Property="IsMouseOver" Value="false" />
								<Condition Property="IsSelected" Value="true" />
							</MultiTrigger.Conditions>
							<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemForegroundSelectedFocusedBrushKey}}" />
							<Setter TargetName="chrome" Property="State" Value="Focused" />
							<Setter TargetName="highlight" Property="Fill" Value="#40FFFFFF" />
						</MultiTrigger>
						
						<Trigger Property="IsKeyboardFocusWithin" Value="True">
							<Setter TargetName="chrome" Property="InnerBorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListItemBorderSelectedFocusedBrushKey}}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- datagridThemes:DataGridResourceKeys.DataGridRowStyleKey -->
	<Style x:Key="{x:Static datagridThemes:DataGridResourceKeys.DataGridRowStyleKey}" TargetType="{x:Type DataGridRow}">
		<Setter Property="OverridesDefaultStyle" Value="True" />

		<!-- Removed setter because it will prevent the colors defined on the DataGrid style from being applied
		<Setter Property="Background" Value="{StaticResource {x:Static SystemColors.WindowBrushKey}}" />
		-->
		<Setter Property="SnapsToDevicePixels" Value="true" />
		
		<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
		<Setter Property="ValidationErrorTemplate">
			<Setter.Value>
				<ControlTemplate>
					<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" Foreground="Red" Text="!" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DataGridRow}">
					<Border x:Name="DGR_Border" Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
							SnapsToDevicePixels="True">
						<SelectiveScrollingGrid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="Auto" />
								<ColumnDefinition Width="*" />
							</Grid.ColumnDefinitions>

							<Grid.RowDefinitions>
								<RowDefinition Height="*" />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>

							<DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}"
									SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

							<DataGridDetailsPresenter
									SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=AreRowDetailsFrozen, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}}"
									Grid.Column="1" Grid.Row="1" Visibility="{TemplateBinding DetailsVisibility}" />

							<DataGridRowHeader SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
									Grid.RowSpan="2"
									Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Row}}" />
						</SelectiveScrollingGrid>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!-- datagridThemes:DataGridResourceKeys.DataGridStyleKey -->
	<Style x:Key="{x:Static datagridThemes:DataGridResourceKeys.DataGridStyleKey}" TargetType="{x:Type DataGrid}">
		<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListBackgroundNormalBrushKey}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListBorderNormalBrushKey}}" />
		<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListBorderNormalThicknessKey}}" />
		<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ControlForegroundNormalBrushKey}}" />

		<Setter Property="RowBackground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowBackgroundNormalBrushKey}}" />
		<Setter Property="AlternatingRowBackground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListRowAlternateBackgroundNormalBrushKey}}" />

		<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListGridLineBackgroundNormalBrushKey}}" />
		<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListGridLineBackgroundNormalBrushKey}}" />

		<Setter Property="datagrid:FocusBehavior.TrackingModes" Value="Headers" />

		<Setter Property="RowHeaderWidth" Value="14" />

		<!-- This is needed to force DG to have a non-default value.  Otherwise the DGR.DetailsVisibility cannot have a value of VisibleWhenSelected by default. -->
		<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
		<Setter Property="ScrollViewer.CanContentScroll" Value="true" />

		<Setter Property="CellStyle" Value="{DynamicResource {x:Static datagridThemes:DataGridResourceKeys.DataGridCellStyleKey}}" />
		<Setter Property="ColumnHeaderStyle" Value="{DynamicResource {x:Static datagridThemes:DataGridResourceKeys.DataGridColumnHeaderStyleKey}}" />
		<Setter Property="RowHeaderStyle" Value="{DynamicResource {x:Static datagridThemes:DataGridResourceKeys.DataGridRowHeaderStyleKey}}" />
		<Setter Property="RowStyle" Value="{DynamicResource {x:Static datagridThemes:DataGridResourceKeys.DataGridRowStyleKey}}" />

		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DataGrid}">
					<shared:ElementChrome x:Name="chrome" Background="{TemplateBinding Background}"
							BackgroundDisabled="{DynamicResource {x:Static themes:AssetResourceKeys.ListBackgroundDisabledBrushKey}}" BorderBrush="{TemplateBinding BorderBrush}"
							BorderBrushDisabled="{DynamicResource {x:Static themes:AssetResourceKeys.ListBorderDisabledBrushKey}}" BorderThickness="{TemplateBinding BorderThickness}"
							BorderStyle="{DynamicResource {x:Static themes:AssetResourceKeys.ListElementChromeBorderStyleKey}}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
						<ScrollViewer x:Name="DG_ScrollViewer" Focusable="False">
							<ScrollViewer.Template>
								<ControlTemplate TargetType="{x:Type ScrollViewer}">
									<Grid>
										<Grid.RowDefinitions>
											<RowDefinition Height="Auto" />
											<RowDefinition Height="*" />
											<RowDefinition Height="Auto" />
										</Grid.RowDefinitions>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="*" />
											<ColumnDefinition Width="Auto" />
										</Grid.ColumnDefinitions>

										<Button Style="{StaticResource DataGridSelectAllStyle}"
												Width="{Binding Path=CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
												Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.All}}" />
										
										<!-- 12/12/2011 - Updated to use scrollbar background for top-left corner -->
										<Border Grid.Column="2" Background="{Binding ElementName=PART_VerticalScrollBar, Path=Background}" />

										<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
												Grid.Column="1" Style="{StaticResource DataGridColumnHeadersPresenterStyle}"
												Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Column}}" />

										<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.ColumnSpan="2"
												Grid.Row="1" Content="{TemplateBinding Content}"
												ContentStringFormat="{TemplateBinding ContentStringFormat}"
												ContentTemplate="{TemplateBinding ContentTemplate}"
												CanContentScroll="{TemplateBinding CanContentScroll}"
												CanHorizontallyScroll="False" CanVerticallyScroll="False" />

										<ScrollBar x:Name="PART_VerticalScrollBar" Grid.Row="1" Grid.RowSpan="2" Grid.Column="2"
												Orientation="Vertical"
												Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
												ViewportSize="{TemplateBinding ViewportHeight}"
												Maximum="{TemplateBinding ScrollableHeight}"
												Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />

										<Grid Grid.Column="1" Grid.Row="2">
											<Grid.ColumnDefinitions>
												<ColumnDefinition
														Width="{Binding Path=NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
												<ColumnDefinition Width="*" />
											</Grid.ColumnDefinitions>

											<ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Orientation="Horizontal"
													Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
													ViewportSize="{TemplateBinding ViewportWidth}"
													Maximum="{TemplateBinding ScrollableWidth}"
													Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
										</Grid>
									</Grid>
								</ControlTemplate>
							</ScrollViewer.Template>
							<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
						</ScrollViewer>
					</shared:ElementChrome>

					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ControlForegroundDisabledBrushKey}}" />
							<Setter TargetName="chrome" Property="State" Value="Disabled" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>

		<Style.Triggers>
			<Trigger Property="IsGrouping" Value="true">
				<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
			</Trigger>
		</Style.Triggers>
	</Style>

	<!-- datagrid:ThemedDataGrid -->
	<Style x:Key="{x:Type datagrid:ThemedDataGrid}" TargetType="{x:Type datagrid:ThemedDataGrid}" BasedOn="{StaticResource {x:Static datagridThemes:DataGridResourceKeys.DataGridStyleKey}}" />

</ResourceDictionary>